<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        button {
            width: 80px;
            height: 20px;
            background-color: pink;
            border: 0;
            
        }
    </style>
</head>

<body>
    <!-- ## 2.验证码匹配的问题 -->
    请输入验证码：<input type="text" id="yzm" value="">
    <button id="btn"></button>
    <input type="button" value="确定" id="qd">
    <script src="../code/js/utils.js"></script>
    <script>
        btn.onclick = function () {
            btn.innerHTML = randomNum(1000, 9999);
            qd.onclick = function () {
                if (yzm.value === btn.innerHTML) {
                    alert('输入正确');
                } else {
                    alert('输入错误，请重试');
                }
            }
        }
    </script>
</body>

</html>